//
//  DZMRMSettingView.swift
//  DZMeBookRead
//
//  Created by 邓泽淼 on 2017/5/11.
//  Copyright © 2017年 DZM. All rights reserved.
//

import UIKit

class DZMRMSettingView: DZMRMBaseView {

    /// 添加控件
    override func addSubviews() {
        
        super.addSubviews()
        
        guard let readMenu_ = self.readMenu else { return }

        let lightView = DZMRMLightView(frame: CGRect.zero, readMenu: readMenu_)
        self.addSubview(lightView)
        lightView.snp.makeConstraints { (make) in
            make.left.right.top.equalToSuperview()
            make.height.equalTo(60.0)
        }
        
        // 颜色
        let colorView = DZMRMColorView(frame:CGRect.zero,readMenu:readMenu_,
                                       colors:CLReadConfigure.shared.readerBgColors,
                                       selectIndex:CLReadConfigure.shared.colorIndex)
        self.addSubview(colorView)
        colorView.snp.makeConstraints { (make) in
            make.left.right.equalToSuperview()
            make.top.equalTo(lightView.snp.bottom)
            make.height.equalTo(74.0)
        }
    
        // 翻页效果 labels 排放顺序参照 DZMRMNovelEffectType
        let effectView = DZMRMFuncView(frame:CGRect.zero, readMenu:readMenu_,
                                       funcType: .effect, title:"动画",
                                       labels:["无效果","平移","仿真"],
                                       selectIndex:CLReadConfigure.shared.effectType.rawValue)
        self.addSubview(effectView)
        effectView.snp.makeConstraints { (make) in
            make.left.right.equalToSuperview()
            make.top.equalTo(colorView.snp.bottom)
            make.height.equalTo(68.0)
        }
        
        // 字体 labels 排放顺序参照 DZMRMNovelFontType
        let fontView = DZMRMFuncView(frame:CGRect.zero, readMenu:readMenu_,
                                     funcType: .font, title:"字体",
                                     labels:["系统","楷体","宋体"],
                                     selectIndex:CLReadConfigure.shared.fontType.rawValue)
        self.addSubview(fontView)
        fontView.snp.makeConstraints { (make) in
            make.left.right.equalToSuperview()
            make.top.equalTo(effectView.snp.bottom)
            make.height.equalTo(68.0)
        }
        
        // 字体大小
        let fontSizeView = DZMRMFuncView(frame:CGRect.zero, readMenu:readMenu_, funcType: .fontSize, title:"字号")
        self.addSubview(fontSizeView)
        fontSizeView.snp.makeConstraints { (make) in
            make.left.right.equalToSuperview()
            make.top.equalTo(fontView.snp.bottom)
            make.height.equalTo(68.0)
        }
    }

}
